package com.example.mybatis.dao;

import com.example.mybatis.pojo.Person;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.StatementType;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author:谢君臣
 * @Date:2021/6/6-15:45
 * @version:1.0
 * @function:
 */
@CacheNamespace
@CacheNamespaceRef(value = PersonMapper.class) // 缓存引用，保证两个空间共用一个缓存空间（可以同时清空）
@Repository(value = "personMpper")
public interface PersonMapper {
    List<Person> getListPerson();

    Person getOneById(long id);

    @Select("select * from person where id = #{1}")
    Person selectById(long id);

    @Select("select * from person where name = #{username} and pwd = #{password}")
    Person selectByUsernameAndPassword(String username, String password);

    @Select("select * from person where mobile = #{mobile} and name = #{username}")
    Person selectByUsernameAndMobile(@Param("username") String usernaem, @Param("mobile")String mobile);


}
